﻿// 显示lena图像
//对图像进行RGB和SHV的分解

#include<opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
	//加载图片
	Mat srcimg = imread("E:\\jiqishijue\\opencv图和视频\\lena.jpg");
	if (srcimg.empty())
	{
		cout << "Load Image Error" << endl;
		return -1;
	}
	imshow("srcWindow", srcimg);
	//将原图转换成hsv图像
	Mat HSVdst;
	cvtColor(srcimg, HSVdst, CV_BGR2HSV);
	//HSV通道分离
	Mat HSVchannels[3];
	split(HSVdst, HSVchannels);
	imshow("Hchannel", HSVchannels[0]);
	imshow("Schannel", HSVchannels[1]);
	imshow("Vchannel", HSVchannels[2]);
	//将原图转换成分离成RGB通道
	Mat BGRchannels[3];
	split(srcimg, BGRchannels);
	imshow("Bchannel", BGRchannels[0]);
	imshow("Gchannel", BGRchannels[1]);
	imshow("Rchannel", BGRchannels[2]);

	cout << "Hello World" << endl;
	waitKey();
	return 0;
}


